﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Menu.Master" AutoEventWireup="true" CodeBehind="VariantesXEstilo.aspx.cs" Inherits="Emporium_Web.VariantesXEstilo" 
Theme="Constellation" %>

<%@ MasterType VirtualPath="~/Menu.master" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<%@ Register src="Search/CombinacionAdd.ascx" tagname="CombinacionAdd" tagprefix="uc1" %>

<%@ Register src="Search/TallaAdd.ascx" tagname="TallaAdd" tagprefix="uc2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" src="js/funciones.grid.js"></script>
    <script type="text/javascript">
        var hdnSeleccionCmbId = '<%= this.hdnSeleccionCmb.ClientID %>';

        function CheckCombinacion(itemId) {           
            Regs = document.getElementById(hdnSeleccionCmbId);
            Regs.value = itemId;
        }

        var hdnSeleccionTalId = '<%= this.hdnSeleccionTal.ClientID %>';

        function CheckTalla(itemId) {
            Regs = document.getElementById(hdnSeleccionTalId);
            Regs.value = itemId;
        }       
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <!-- Content -->
    <article class="container_12">
	  
		<section class="grid_12">
			<div class="block-border">
			<form runat="server" class="block-content form" id="table_form">
				<h1>Variantes por Estilo</h1>
                <ajaxToolkit:ToolkitScriptManager ID="toolk" runat="server"></ajaxToolkit:ToolkitScriptManager>               

                <asp:UpdatePanel ID = "upContent" runat="server">
                <ContentTemplate>   
                <div>
                <div style="width: 100%; padding-top: 20px;">
                    <div style="width: 100%; height: 45px; float: inherit;">
                        <div style="width: 100px; float: left;">
                            <label>
                                  Estilo</label>
                        </div>
                        <div align="left" style="width: 70%; float: left;">
                             <asp:TextBox ID="txtEstilo" Enabled="false" runat="server" Width="300px"></asp:TextBox>
                        </div>
                    </div>     
                </div>
               
                <ul class="message error no-margin" runat="server" id="errorMessage">
					    <li><asp:Label runat="server" ID="lblErrorMessage"></asp:Label></li>
				</ul>
                <ul class="message warning no-margin" runat="server"  id="warningMessage">
					<li><asp:Label runat="server" ID="lblWarningMessage"></asp:Label></li>
				</ul>    

                <asp:HiddenField ID="hdnSeleccionCmb" runat="server" />
                <asp:HiddenField ID="hdnSeleccionTal" runat="server" />
                

                <div style="width:100%; float:left; padding-top:11px; padding-bottom:20px;">
                    <div style="width:100%; float:left;" align="left">                               
                    <asp:GridView ID="gvVariantes" runat="server" SkinID="gridviewSkin" PageSize="10" Width="100%"
                            AutoGenerateColumns="False" ShowFooter="True" DataKeyNames = "Variante_Id"
                            onrowdeleting="gvVariantes_RowDeleting" 
                            onrowediting="gvVariantes_RowEditing" 
                            onrowupdating="gvVariantes_RowUpdating" 
                            onrowcancelingedit="gvVariantes_RowCancelingEdit" 
                            onrowcommand="gvVariantes_RowCommand" 
                            onrowdatabound="gvVariantes_RowDataBound">
						<Columns>
                            <asp:TemplateField>
								<HeaderTemplate>
								</HeaderTemplate>
								<ItemTemplate>
                                      <input id="rbSelect" type="radio" name="selectGroup" value="rbSelect" />
								</ItemTemplate>
								<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
								<ItemStyle HorizontalAlign="Left" Width="5%" />
							</asp:TemplateField>
                            <asp:TemplateField HeaderText="Secuencial"  HeaderStyle-HorizontalAlign="Left"> 
                                <EditItemTemplate> 
                                    <asp:Label ID="lblSecuencia" runat="server" Text='<%# Bind("Variante_Secuencia","{0:000}") %>'></asp:Label>
                                </EditItemTemplate> 
                                <ItemTemplate> 
                                    <asp:Label ID="lblSecuencia" runat="server" Text='<%# Bind("Variante_Secuencia","{0:000}") %>'></asp:Label> 
                                </ItemTemplate> 
                                <ItemStyle Width="5%" />
                            </asp:TemplateField> 
                            <asp:TemplateField HeaderText="Descripcion" HeaderStyle-HorizontalAlign="Left"> 
                                <EditItemTemplate> 
                                    <asp:TextBox ID="txtDescripcion" runat="server" Text='<%# Bind("Variante_Descripcion") %>' Width="95%" ></asp:TextBox> 
                                    <asp:RequiredFieldValidator ID="reqEditDescripcion" runat="server" ControlToValidate="txtDescripcion" ErrorMessage="" ValidationGroup ="EditarVariante"></asp:RequiredFieldValidator>
                                </EditItemTemplate> 
                                <FooterTemplate> 
                                    <asp:TextBox ID="txtNewDescripcion" runat="server" Width="95%"></asp:TextBox> 
                                    <asp:RequiredFieldValidator ID="reqNewDescripcion" runat="server" ControlToValidate="txtNewDescripcion" ErrorMessage="" ValidationGroup ="AgregarVariante"></asp:RequiredFieldValidator>
                                </FooterTemplate> 
                                <ItemTemplate> 
                                    <asp:Label ID="lblDescripcion" runat="server" Text='<%# Bind("Variante_Descripcion") %>'></asp:Label> 
                                </ItemTemplate> 
                                <ItemStyle Width="50%" />
                            </asp:TemplateField>						

                             <asp:TemplateField HeaderText="Estado"  HeaderStyle-HorizontalAlign="Left"> 
                                <EditItemTemplate>                                     
                                    <asp:DropDownList ID="ddlEditEstado" runat="server" SelectedValue='<%# Eval("Variante_Estado") %>' > 
                                        <asp:ListItem Value="R" Text="REGISTRADO"></asp:ListItem>
                                        <asp:ListItem Value="O" Text="OPERATIVO"></asp:ListItem>
                                    </asp:DropDownList>
                                </EditItemTemplate> 
                                <FooterTemplate> 
                                    <asp:Label ID="lblNewEstado" runat="server" ></asp:Label> 
                                </FooterTemplate> 
                                <ItemTemplate>
                                    <asp:Label ID="lblEstado" runat="server" Text='<%# Eval("Variante_Estado") %>' ></asp:Label>                                      
                                </ItemTemplate> 
                            </asp:TemplateField>
                            						
                             <asp:TemplateField HeaderText="F.Registro"  HeaderStyle-HorizontalAlign="Left"> 
                                <EditItemTemplate> 
                                    <asp:Label ID="lblFechaRegistro" runat="server" Text='<%# Bind("Variante_FechaRegistro", "{0:dd/MM/yyyy}") %>'></asp:Label>
                                </EditItemTemplate> 
                                <FooterTemplate> 
                                   <asp:Label ID="txtNewFechaRegistro" runat="server" ></asp:Label> 
                                </FooterTemplate> 
                                <ItemTemplate> 
                                    <asp:Label ID="lblFechaRegistro" runat="server" Text='<%# Bind("Variante_FechaRegistro","{0:dd/MM/yyyy}") %>'></asp:Label> 
                                </ItemTemplate> 
                            </asp:TemplateField>     
                            
                             <asp:TemplateField ShowHeader="False" HeaderStyle-HorizontalAlign="Left"> 
                                <EditItemTemplate> 
                                    <asp:LinkButton ID="lbkUpdate" runat="server" CausesValidation="True" CommandName="Update" Text="Actualizar" ValidationGroup ="EditarVariante"></asp:LinkButton> 
                                    <asp:LinkButton ID="lnkCancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancelar"></asp:LinkButton> 
                                </EditItemTemplate> 
                                <FooterTemplate> 
                                    <asp:LinkButton ID="lnkAdd" runat="server" CausesValidation="True" CommandName="Insert" Text="Insertar" ValidationGroup = "AgregarVariante"></asp:LinkButton> 
                                </FooterTemplate> 
                                <ItemTemplate> 
                                    <asp:LinkButton ID="lnkEdit" runat="server" CausesValidation="False" CommandName="Edit" Text="Editar"></asp:LinkButton> 
                                </ItemTemplate> 
                            </asp:TemplateField> 
                              
                            <asp:TemplateField ShowHeader="False"> 
                                <ItemTemplate> 
                                    <asp:LinkButton ID="lnkDelete" runat="server" CausesValidation="False" CommandName="Delete" Text="Eliminar" OnClientClick="return DeleteRegistro();"></asp:LinkButton> 
                                </ItemTemplate> 
                            </asp:TemplateField>      
                                                 
						</Columns>  
						<PagerSettings Visible="false" />
					</asp:GridView> 

                    </div>					
				</div>
                
				<div style="width:100%; float:left; padding-top:11px; padding-bottom:35px;">
                            
                    <div style="width:45%; float:left; padding-right:5%;" align="left">
                    <label>Combinaciones</label>                    
                    <asp:GridView ID="gvCombinaciones" runat="server" SkinID="gridviewSkin" Width="100%"
                            PageSize="10" AutoGenerateColumns="False">
                        
						<Columns>
                            <asp:TemplateField>
								<HeaderTemplate>
								</HeaderTemplate>
								<ItemTemplate>                                      
                                      <input id="Radio1" type="radio" name="selectGroup" value="rbSelect" onclick="javascript:CheckCombinacion('<%# Eval("Combinacion_Id") %>');"/>
								</ItemTemplate>
								<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
								<ItemStyle HorizontalAlign="Left" Width="5%" />
							</asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>Código</HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("Combinacion_Id", "{0:00000}")%>
                                </ItemTemplate>
                                 <ItemStyle Width = "10%" />
                            </asp:TemplateField>
							<asp:BoundField DataField="Combinacion_Descripcion" HeaderText="Descripción" >  
                                <ItemStyle Width = "85%" />
                            </asp:BoundField>

						</Columns>  
						<PagerSettings Visible="false" />
					</asp:GridView> 
                    
                    <div align="left" style="width:90%; float:inherit; vertical-align:middle; padding-top:15px;">
					    <asp:LinkButton ID="btnCombinacionesAdicionar" runat="server" Text="Adicionar" 
                            CssClass="button" onclick="btnCombinacionesAdicionar_Click" />
				        <asp:LinkButton ID="btnCombinacionesEliminar" runat="server" Text="Eliminar" 
                            CssClass="button" onclick="btnCombinacionesEliminar_Click" />
					    <asp:LinkButton ID="btnCombinacionesGrabar" runat="server" Text="Grabar" 
                            CssClass="button" onclick="btnCombinacionesGrabar_Click" />

				        <uc1:CombinacionAdd ID="combinacionAdd" runat="server" />
				    </div>                   

                    </div>

                    <div style="width:50%; float:left;" align="left">
                    <label>Tallas</label>                    
                    <asp:GridView ID="gvTallas" runat="server" SkinID="gridviewSkin" PageSize="10" Width="100%"
                            AutoGenerateColumns="False">
						<Columns>
                            <asp:TemplateField>
								<HeaderTemplate>
								</HeaderTemplate>
								<ItemTemplate>                                      
                                      <input id="Radio1" type="radio" name="selectGroup" value="rbSelect" onclick="javascript:CheckTalla('<%# Eval("Talla_Id") %>');"/>
								</ItemTemplate>
								<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
								<ItemStyle HorizontalAlign="Left" Width="5%" />
							</asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>Código</HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("Talla_Id", "{0:00000}")%>
                                </ItemTemplate>
                                 <ItemStyle Width = "10%" />
                            </asp:TemplateField>
							<asp:BoundField DataField="Talla_DescripcionCorta" HeaderText="Talla">  
                                <ItemStyle Width = "20%" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Talla_DescripcionLarga" HeaderText="Descripción" >  
                                <ItemStyle Width = "65%" />
                            </asp:BoundField>  							
						</Columns>  
						<PagerSettings Visible="false" />
					</asp:GridView> 
                    
                    
                    <div align="left" style="width:90%; float:inherit; vertical-align:middle; padding-top:15px;">
					        <asp:LinkButton ID="btnTallasAdicionar" runat="server" Text="Adicionar" 
                                CssClass="button" onclick="btnTallasAdicionar_Click" />
				            <asp:LinkButton ID="btnTallasEliminar" runat="server" Text="Eliminar" 
                                CssClass="button" onclick="btnTallasEliminar_Click" />
					        <asp:LinkButton ID="btnTallasGrabar" runat="server" Text="Grabar" 
                                CssClass="button" onclick="btnTallasGrabar_Click" />
				            <uc2:TallaAdd ID="tallaAdd" runat="server" />
				        </div>
                    </div>
					
				</div>
                
                <div align="left" style="width:100%; float:inherit; vertical-align:middle;">
					    <asp:LinkButton ID="btnAtras" runat="server" Text="Atr&aacute;s"  CssClass="button red" onclick="btnAtras_Click" />
				</div>				
                </div>
                </ContentTemplate>
                </asp:UpdatePanel>
			</form>
			</div>
		</section>
	</article>
</asp:Content>
